<template>
  <div>
    <div class="title">课程评分排行榜</div>
    <el-table :data="data" style="width: 100%" height="326" border :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }">
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column label="课程名" prop="name"></el-table-column>
      <el-table-column label="任课教师" prop="teacher"></el-table-column>
      <el-table-column label="评分" prop="score">
        <template slot-scope="scope">
            <el-rate v-model="scope.row.score" disabled></el-rate>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getCourseRange } from '#/CourseManagement/Course'
export default {
  name: 'DataViewOne',
  created() {
    this.getCourseRange();
  },
  data() {
    return {
      data: []
    };
  },
  methods: {
    async getCourseRange() {
      await getCourseRange().then(res => {
        if(res.data.ret === 0) {
          this.data = res.data.courses.courses.content.reverse();
        }
      })
    }
  },
};
</script>

<style lang="less" scoped>
.title {
  font-weight: bold;
  margin-bottom: 20px;
}
</style>